home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.2)
-
- from wxPython.wx import *
- from class_conecta import *
- from class_excel import *
-
- def create(parent):
- return Frame(parent)
-
- (wxID_FRAME, wxID_FRAMEBTNSUBMIT, wxID_FRAMECPBD, wxID_FRAMECPSENHA, wxID_FRAMECPSERVIDOR, wxID_FRAMECPTABELA, wxID_FRAMECPUSUARIO, wxID_FRAMEPANEL1, wxID_FRAMESTATICTEXT1, wxID_FRAMESTATICTEXT2, wxID_FRAMESTATICTEXT3, wxID_FRAMESTATICTEXT4, wxID_FRAMESTATICTEXT5) = map((lambda _init_ctrls: wxNewId()), range(13))
-
- class Frame(wxFrame):
-
- def _init_utils(self):
- pass
-
-
- def _init_ctrls(self, prnt):
- wxFrame.__init__(self, id = wxID_FRAME, name = u'Frame', parent = prnt, pos = wxPoint(524, 314), size = wxSize(448, 247), style = wxDEFAULT_FRAME_STYLE, title = u'Mysql2Excel')
- self._init_utils()
- self.SetClientSize(wxSize(440, 217))
- self.panel1 = wxPanel(id = wxID_FRAMEPANEL1, name = 'panel1', parent = self, pos = wxPoint(0, 0), size = wxSize(440, 217), style = wxTAB_TRAVERSAL)
- self.cpServidor = wxTextCtrl(id = wxID_FRAMECPSERVIDOR, name = u'cpServidor', parent = self.panel1, pos = wxPoint(160, 8), size = wxSize(144, 21), style = 0, value = 'IP ou DNS')
- self.cpUsuario = wxTextCtrl(id = wxID_FRAMECPUSUARIO, name = u'cpUsuario', parent = self.panel1, pos = wxPoint(160, 40), size = wxSize(144, 21), style = 0, value = 'usuario')
- self.staticText1 = wxStaticText(id = wxID_FRAMESTATICTEXT1, label = u'Servidor', name = 'staticText1', parent = self.panel1, pos = wxPoint(112, 8), size = wxSize(39, 13), style = 0)
- self.staticText2 = wxStaticText(id = wxID_FRAMESTATICTEXT2, label = u'Usuário', name = 'staticText2', parent = self.panel1, pos = wxPoint(112, 40), size = wxSize(40, 16), style = 0)
- self.cpSenha = wxTextCtrl(id = wxID_FRAMECPSENHA, name = u'cpSenha', parent = self.panel1, pos = wxPoint(160, 72), size = wxSize(144, 21), style = wxTE_PASSWORD, value = 'senha')
- self.staticText3 = wxStaticText(id = wxID_FRAMESTATICTEXT3, label = u'Senha', name = 'staticText3', parent = self.panel1, pos = wxPoint(112, 72), size = wxSize(31, 13), style = 0)
- self.cpBD = wxTextCtrl(id = wxID_FRAMECPBD, name = u'cpBD', parent = self.panel1, pos = wxPoint(160, 104), size = wxSize(144, 21), style = 0, value = 'seu BD')
- self.staticText4 = wxStaticText(id = wxID_FRAMESTATICTEXT4, label = u'Banco de dados', name = 'staticText4', parent = self.panel1, pos = wxPoint(72, 104), size = wxSize(78, 13), style = 0)
- self.cpTabela = wxTextCtrl(id = wxID_FRAMECPTABELA, name = u'cpTabela', parent = self.panel1, pos = wxPoint(160, 136), size = wxSize(144, 21), style = 0, value = 'sua tabela')
- self.staticText5 = wxStaticText(id = wxID_FRAMESTATICTEXT5, label = u'Tabela', name = 'staticText5', parent = self.panel1, pos = wxPoint(112, 136), size = wxSize(40, 16), style = 0)
- self.btnSubmit = wxButton(id = wxID_FRAMEBTNSUBMIT, label = u'Criar Tabela do Excel', name = u'btnSubmit', parent = self.panel1, pos = wxPoint(168, 176), size = wxSize(112, 23), style = 0)
- EVT_BUTTON(self.btnSubmit, wxID_FRAMEBTNSUBMIT, self.OnBtnsubmitButton)
-
-
- def __init__(self, parent):
- self._init_ctrls(parent)
-
-
- def OnBtnsubmitButton(self, event):
- excel = myExcel()
- host = self.cpServidor.GetValue()
- user = self.cpUsuario.GetValue()
- senha = self.cpSenha.GetValue()
- banco = self.cpBD.GetValue()
- tabela = self.cpTabela.GetValue()
- dados = conecta(host, user, senha, banco)
- res = dados.query('select * from ' + tabela)
- line = 0
- for record in res:
- col = 0
- for field in res[line]:
- excel.setCell(1, line + 1, col + 1, res[line][col])
- col += 1
-
- line += 1
-
- excel.save(tabela)
- excel.close()
-
-
-